package com.itheima.prize.commons.db.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.prize.commons.db.entity.CardGame;
import com.itheima.prize.commons.db.service.CardGameService;
import com.itheima.prize.commons.db.mapper.CardGameMapper;
import com.itheima.prize.commons.utils.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author shawn
* @description 针对表【card_game】的数据库操作Service实现
* @createDate 2023-12-26 11:58:48
*/
@Service
public class CardGameServiceImpl extends ServiceImpl<CardGameMapper, CardGame>
    implements CardGameService{
@Autowired
private CardGameMapper cardGameMapper;
    @Override
    public PageBean<CardGame> searchGameList(int status, int curpage, int limit) {
        Page<CardGame> page=new Page<>(curpage,limit);
        LambdaQueryWrapper<CardGame> wrapper=new LambdaQueryWrapper<>();
//        wrapper.eq(CardGame::getStatus,status);
        Page<CardGame> page1 = cardGameMapper.selectPage(page, wrapper);
        PageBean<CardGame> cardGamePageBean=new PageBean<>(page1);
        return cardGamePageBean;
    }

    @Override
    public CardGame searchGameInfo(int gameid) {
        CardGame cardGame = cardGameMapper.selectById(gameid);
        return cardGame;
    }
}




